import Ember from 'ember';
import BaseItem from '../ui/base-ui-item';
export default BaseItem.extend({
  constants: Constants,
  store: Ember.inject.service("store"),
  detailModify: false,

  didInsertElement: function() {
    let extendInfo= this.get('store').peekRecord('customer-extend',this.get("customerInComp.customerExtend.id"));
    if(!extendInfo){
      extendInfo = this.get('store').createRecord('customer-extend',{});
      extendInfo.set('customer',this.get('customerInComp'));
    }
    this.set("extendInfo",extendInfo);
  },

  actions: {
    invalid() {
    },
    //修改
    detailModifyClick: function() {
        this.set('detailModify', true);
    },
    cancelClick(){
      this.set('detailModify',false);
    },
    detailSaveClick(){
      let _self = this;
      let extendInfo = this.get('extendInfo');
      App.lookup('controller:business.mainpage').openPopTip("正在保存");
      extendInfo.save().then(function(preference){
        App.lookup('controller:business.mainpage').showPopTip("保存成功");
        _self.set('detailModify',false);
      });
    },
  }

});
